<template >
    <section>
        <div class="main-content">
            <div class="left-nav">
                <div class='logo'>
                <img src="@/assets/css/images/icons.png" alt="">
                </div>
                <ul>
                <li v-for="n in sidebarList" @click="jumpmodle(n.type)" :class="currentSelect == n.type? 'active': ''">
                    <i class="iconfont" :class="n.icon"></i>
                    <p>{{n.name}}</p>
                </li>
                </ul>
            </div>
            <div class="right-content">
                <router-view></router-view>
            </div>
        </div>
        <SrarchPopup ref="changeMoldeState"></SrarchPopup>
    </section>
</template>

<script>
  import SrarchPopup from '@/components/content/Search/index.vue'
  export default {
    name: 'modle',
    data () {
      return {
        sidebarList: [
          {name: '收银', type: "cart",icon:'icon-goumaiyemiande-jiarugouwuche'},
          {name: '查询', type: "search" ,icon:'icon-chaxun'},
          {name: '退款', type: "Refund" ,icon:'icon-jinbi'},
          {name: '设置', type: "Setting" ,icon:'icon-iconfonticonfontjixieqimo'},
          {name: '登入后台', type: "Admin" ,icon:'icon-houtaiyonghuguanli'},
        ],
        currentSelect: 'cart',
        login_info:{},
      }
    },
    components: {
      SrarchPopup,
    },
    mounted () {
        // this.init()
    },
    methods: {
        init () {
           // TODO
        },
        // 跳转各模块
        jumpmodle(type) {
            this.currentSelect = type;
            switch (type) {
            case 'cart':
                // router.push('/cart')
                this.$router.push({name:'Cart'})
                break;
            case 'search':
                // router.push('/search')
                this.$refs.changeMoldeState.showSearchBox()
                // this.$router.push({name:'Search'})
                break;
            case 'Refund':
                // router.push('/refund')
                this.$router.push({name:'Refund'})
                break;
            case 'Setting':
                // router.push('/setting')
                this.$router.push({name:'Setting'})
                break;
            case 'Admin':
                this.$router.push({name:'Admin'})
                // router.push('/enter-admin')
                break;
            }
        }
    }
  }
</script>

<style lang="less">
@import '~@/assets/less/entry.less';
</style>


